# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')

class FT_0783:
    result=[]
    analysisDecription = ['自定义消息体长度：','新ECU ID长度：','新ECU ID：','原ECU ID长度：','原ECU ID']
    analysis0783Length=[2,1,0,1,0]

    def LogicAisle(self, protocolStr, header):
        count=0
        for i in range(len(self.analysisDecription)):
            s=protocolStr[count:count+self.analysis0783Length[i]*2]
            if i==1 or i==3:
                length=int(s,16)
                self.analysis0783Length[i+1]=length
                header.append(self.analysisDecription[i]+str(length)+'\n')
            elif i==2 or i==4:
                id=s.decode("hex").decode('gb2312')
                header.append(self.analysisDecription[i]+id+'\n')
            else:
                header.append(self.analysisDecription[i]+s+'\n')
        self.result=header
